﻿@{
    Layout = "~/Views/Shared/_General.cshtml";
    ViewBag.SiteCategory = "home";
}

@*<script type="text/javascript">

//    function favoriteClick(b){
//        var cardid = b.parent().parent().prev().attr('id');
//            var params = "{cardID:\"" + cardid + "\",callback:\"" + "<script>alert(\'1\');<\/script>" + "\"}";
//            $.ajax({
//                type: "POST",
//                cache:false,
//                url: "@Url.Action("Add", "Favorite")",
//                data: params,
//                dataType: "html", //back type
//                contentType: "application/json; charset=utf-8",
//                success: function (result) {
//                        showAjaxDialog(result);
//                    },
//                    error: function (xhr, msg, e) {
//                        alert(msg);
//                    }
//            });
//            return false;
//    }

    $(function () {
        //high light li(0)
        $("div#SiteIndex ul li:eq(0) a").addClass("xt");
        $("select.products_name_chose").bind("change", function (e) {
            var currency_type = $(this).val();
            var currency_type_str = $(this).children("option:selected").text();
                 var cardinforid1 = $(this).parent().attr('id');
                 var params = '{CurrencyType:"' + currency_type + '",CardInfoID:"' + cardinforid1 + '"}';
                 $.ajax({
                    type: "POST",
                    cache:false,
                    url: "@Url.Action("GetCardsPriceInfo", "Exchange")",
                    data: params,
                    dataType: "json",
                    contentType: "application/json; charset=utf-8",
                    success: function (result) {
                        var cardPriceCollection = result.cardsPrice;
                        var cardinfoid = result.CardInfoID;
                        var divitem = $("div#" + cardinfoid);
                        var divc = divitem.children(":eq(2)");
                        divc.find('td').each(function(index){
                            var Idattr = $(this).attr('id');
                            var thistd = $(this);
                            $.each(cardPriceCollection,function(index,item){
                                if(item.CardId == Idattr)
                                {
                                    thistd.find('.products_arrow_price1').html(currency_type_str);
                                    thistd.find('.commonprice').html(item.CommomPrice);
                                    thistd.find('.vipprice').html(item.VIPPrice);
                                }
                            });
                        });
                    },
                    error: function (xhr, msg, e) {
                        alert(msg);
                    }
                 });

             });

        

        //favorite button in home/index
        $("a.products_arrow_ui2").bind("click",function(){
            var cardid = $(this).parent().parent().prev().attr('id');
            var params = "{cardID:\"" + cardid + "\",callback:\"" + "<script>alert(\'1\');<\/script>" + "\"}";
            $.ajax({
                type: "POST",
                cache:false,
                url: "@Url.Action("Add", "Favorite")",
                data: params,
                dataType: "html", //back type
                contentType: "application/json; charset=utf-8",
                success: function (result) {
                        showAjaxDialog(result);
                    },
                    error: function (xhr, msg, e) {
                        alert(msg);
                    }
            });
            return false;
        });


        //purchase button in home/index
        $("a.purchaseB").bind("click",function(){
            var src = $(this).attr("href");
            var parent_div = $(this).parents("div.products_arrow:first");
            var selectVal = parent_div.prev().find("select.products_name_chose").val();
            location.href = src + "/" + selectVal;
            return false;
            return false;
        });
    });
</script>*@

<div class="main_center">
    @{Html.RenderAction("GlobalPurchasing", "Widget", null);}
    @{Html.RenderAction("GameClass", "Widget", null);}
    @{Html.RenderAction("Top20Sales", "Widget", null);}
</div>
